Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IR: Fix crash on duty_cycle=1 #3568

Merged
merged 3 commits into from
Apr 7, 2024

Conversation

Willy-JL
Copy link
Contributor

@Willy-JL Willy-JL commented Apr 4, 2024

What's new

  • infrared_signal_is_raw_valid() says that duty_cycle > 1 is invalid
  • infrared_worker_set_raw_signal() checks duty_cycle < 1
  • therefore, duty_cycle == 1 fails the check, when really it should be accepted

Verification

  • send an infrared raw with duty_cycle: 1

Checklist (For Reviewer)

  • PR has description of feature/bug or link to Confluence/Jira task
  • Description contains actions to verify feature/bugfix
  • I've built this code, uploaded it to the device and verified feature/bugfix

@skotopes
Copy link
Member

skotopes commented Apr 4, 2024

To be honest duty_cycle=1 is an invalid value that we never tested. It kinda make no sense. It means that no carrier present. Do you have real life examples for this change?

@Willy-JL
Copy link
Contributor Author

Willy-JL commented Apr 4, 2024

I got this report from a friend, they had an IR file with all raws at duty cycle 1. I am not sure if it was captured or generated, but from what they were saying, it seemed to work correctly and do what it was intended to do on older firmware. With furi checks now, it would crash.

@skotopes
Copy link
Member

skotopes commented Apr 4, 2024

I got this report from a friend, they had an IR file with all raws at duty cycle 1. I am not sure if it was captured or generated, but from what they were saying, it seemed to work correctly and do what it was intended to do on older firmware. With furi checks now, it would crash.

That was clearly generated file. What happens with duty cycle 1.0: there will be no carrier frequency. We really'd like to know what system actually uses that kind of signal.

@Willy-JL
Copy link
Contributor Author

Willy-JL commented Apr 4, 2024

He told me it was set to 1 on purpose and used to test accurate IR measuring devices

@Willy-JL Willy-JL requested a review from nminaylov as a code owner April 7, 2024 13:15
@skotopes
Copy link
Member

skotopes commented Apr 7, 2024

@Willy-JL this will work, but not because it was designed to do so.

I highly don't recommend to use it for modulation debugging. Also after some experiments I found that some timings are slightly off.

I'll merge this PR, but more research required.

@skotopes skotopes merged commit c31b60c into flipperdevices:dev Apr 7, 2024
11 checks passed
@Willy-JL Willy-JL deleted the ir-fix-duty-cycle-1 branch April 7, 2024 14:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Infrared Infrared app
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants